package cn.lanqiao.userservice.controller;

import cn.lanqiao.userservice.feign.OrderServiceInterface;
import cn.lanqiao.userservice.vo.OrderVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RefreshScope
@RestController
public class UserController {

    @Value("${JWT.key}")
    private String key;

    @Autowired
    OrderServiceInterface orderServiceInterface;

    @GetMapping("/key")
    public String getKey() {
        return key;
    }

    @GetMapping("/add")
    public String add() {
        OrderVo orderVo = new OrderVo();
        orderVo.setUserId(100);
        orderVo.setProductId(3000);
        String ret = orderServiceInterface.insert(orderVo);
        return ret;
    }
}
